package test.base.sttt;

import com.alibaba.fastjson.JSON;

import hyl.core.MyDate;
import hyl.core.MyFun;
import hyl.core.db.Htable;
import hyl.core.db.MySqlSelect;
import hyl.core.db.SelectWhere;
import hyl.ext.sttt.QueryCache;
import test.My;


public class teststtt {
	public static void main(String[] args) {
		test2();
	}
	public static void test2() {
		QueryCache QueryCache = new QueryCache(4);
		MySqlSelect mss = MySqlSelect.getInstance("select * from flow_link");
		long st = MyFun.getMs();
		Htable ht2 = QueryCache.queryHtable(mss);
		MyFun.print(MyFun.getMs() - st);
		System.out.println("-----------------");
		st = MyFun.getMs();
		ht2 = QueryCache.queryHtable(mss);
		MyFun.print(MyFun.getMs() - st);
		
	}
	public static void test1() {
		QueryCache QueryCache = new QueryCache(4);
		MySqlSelect mss = MySqlSelect.getInstance("select * from member");
		SelectWhere sw = new SelectWhere();
		sw.add("where id=?", 3);

		mss.addParams(sw);
		long st = MyFun.getMs();
		Htable ht = QueryCache.queryHtable(mss);
		MyFun.print(MyFun.getMs() - st, JSON.toJSONString(ht));
		for (int i = 0; i < 3; i++) {
			st = MyFun.getMs();
			Htable ht2 = QueryCache.queryHtable(mss);
			MyFun.print(MyFun.getMs() - st, JSON.toJSONString(ht2));
		}
		//MyDate.sleeps(4);
		mss = MySqlSelect.getInstance("select * from flow ");
		for (int i = 0; i < 3; i++) {
			st = MyFun.getMs();
			Htable ht1 = QueryCache.queryHtable(mss);
			MyFun.print(MyFun.getMs() - st, JSON.toJSONString(ht1));
		}
	}
	
}
